package org.merak;

import java.sql.PreparedStatement;
import java.sql.ResultSet;

import org.merak.core.Application;
import org.merak.core.persistence.jdbc.XConnection;

public class TestaXConnection {

	//~Methods ////////////////////////////////////////////////////////////////////
	//****************************************************************************
	public static void main(String... args) throws Exception {

		// Show all connection
		for (XConnection c : Application.database.getConnections()) {
			System.out.println( c.getSettings() );
		}

		XConnection conn  = Application.database.getConnection("COQDM_DEV");
		int         count = 0;
		while (true) {
			System.out.println( "* LOOP " + count++ );
			Application.io.pause();//("Hit Enter Key to do the query...");
			try {
				PreparedStatement st = conn.prepareStatement("SELECT 1 FROM dual");
				ResultSet         rs = st.executeQuery();
				if (rs.next()) System.out.println( rs.getString(1) );
				st.close();
			}
			catch (Exception ex) {
				ex.printStackTrace();
			}
		}

	}
	//*****************************************************************************/

}
